]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
animation: Stop the animation before removing all the children
authorMarco Trevisan (Treviño) <mail@3v1n0.net>
Fri, 14 Jun 2019 14:48:16 +0000 (17:48 +0300)
committerFlorian Müllner <florian.muellner@gmail.com>
Mon, 9 Sep 2019 19:28:18 +0000 (19:28 +0000)
If the resource scale or the scale factor changes while the animation
is playing, we need to stop the animation and start it again once the
texture is loaded, as the idle might try to access an invalidated
animation child otherwise.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/700

js/ui/animation.js

index d66eaa4044adcbe3c7d7643985802755d90cb883..528fb8220f13f14637f9895e30d98ae02ce286c5 100644 (file)
@@ -54,12 +54,19 @@ var Animation = class {
 
     _loadFile(file, width, height) {
         let [validResourceScale, resourceScale] = this.actor.get_resource_scale();
+        let wasPlaying = this._isPlaying;
+
+        if (this._isPlaying)
+            this.stop();
 
         this._isLoaded = false;
         this.actor.destroy_all_children();
 
-        if (!validResourceScale)
+        if (!validResourceScale) {
+            if (wasPlaying)
+                this.play();
             return;
+        }
 
         let textureCache = St.TextureCache.get_default();
         let scaleFactor = St.ThemeContext.get_for_stage(global.stage).scale_factor;
@@ -67,6 +74,9 @@ var Animation = class {
                                                           scaleFactor, resourceScale,
                                                           this._animationsLoaded.bind(this));
         this.actor.set_child(this._animations);
+
+        if (wasPlaying)
+            this.play();
     }
 
     _showFrame(frame) {